/**
 * Project Name:kany-utils
 * File Name:Configs.java
 * Package Name:me.kany.utils.config
 * Date:2016年1月24日上午11:55:29
 * Copyright (c) 2016, Jason All Rights Reserved.
 *
*/

package me.kany.utils.config;

import java.util.Properties;

/**
 * ClassName:Configs <br/>
 * Function: 创建Config.property文件读取类. <br/>
 * Date: 2016年1月24日 上午11:55:29 <br/>
 * 
 * @author Jason
 * @version
 * @since JDK 1.7
 * @see
 */
public class Configs {
	private static Configs configs = new Configs();
	private static Properties properties = new Properties();

	static {
		try {
			properties.load(Configs.class.getClass().getResourceAsStream("/config/config.properties"));
		} catch (Exception e) {
		}
	}

	/**
	 * 
	 * getInstance:创建单例模式的Configs文件读取类. <br/>
	 *
	 * @author Jason
	 * @return
	 * @since JDK 1.7
	 */
	public static Configs getInstance() {
		if (null == configs) {
			configs = new Configs();
		}
		return configs;
	}

	/**
	 * 
	 * getProperty:读取配置文件中的值，如果读取不到就返回NULL. <br/>
	 *
	 * @author Jason
	 * @param key
	 * @return
	 * @since JDK 1.7
	 */
	public String getProperty(String key) {
		String result = null;
		if (properties.containsKey(key)) {
			result = (String) properties.get(key);
		}
		return result;
	}

}
